package edu.msg.jthr.backend.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "COMMENT")
public class Comment extends BaseEntity {

	private static final long serialVersionUID = 1L;

	@Temporal(TemporalType.DATE)
	@Column(name = "COMMENT_DATE")
	private Date date;
	
	@OneToOne
	@JoinColumn(name = "USER_ID")
	private User user;

	@Column(name = "CONTENT")
	private String content;

	public Comment() {
	}

	public Comment(long id, String uuid, Date date, User user, String content) {
		super(id, uuid);
		this.date = date;
		this.user = user;
		this.content = content;
	}

	public Date getDate() {
		return date == null ? null : (Date) date.clone();
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

}
